package com.fivefu.core.skyeye.event.controller;

import com.alibaba.fastjson2.JSON;
import com.fivefu.base.common.utils.str.StrUtils;
import com.fivefu.base.web.controller.BaseController;
import com.fivefu.base.web.vo.ResultInfo;
import com.fivefu.core.skyeye.event.services.MimirEventService;
import com.fivefu.core.skyeye.event.vo.EventBean;
import com.fivefu.core.skyeye.event.vo.StreamSliceBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 案卷图片表 前端控制器
 * </p>
 *
 * @author 
 * @since 2022-08-29 13:48:15
 */
@Api(tags = "案卷图片")
@RestController
@RequestMapping("/dbAiEventImage")
public class DbAiEventImageController extends BaseController {

    private static final Logger logger = LoggerFactory.getLogger(DbAiEventImageController.class);

    @Resource
    private MimirEventService mimirEventService;

    @ApiOperation(value = "查询探头切片信息",httpMethod = "POST",response = ResultInfo.class,notes = "查询探头切片信息")
    @ApiImplicitParam(name = "code",value = "探头唯一标识",paramType = "query",required = true,dataType = "String")
    @RequestMapping(path = "/getSlice",method = RequestMethod.POST)
    public ResultInfo getStreamSlice(String code) {
        logger.info("查询探头切片信息接收的参数："+ JSON.toJSONString(request.getParameterMap()));
        try {
            if (StrUtils.isNull(code)){
                return ResultInfo.renderError("探头唯一标识不能为空");
            }
            StreamSliceBean streamSliceBean = mimirEventService.queryCameraStreamSlice(code);
            return ResultInfo.renderSuccess(streamSliceBean);

        } catch (Exception e) {
            logger.error(e.getMessage(),e);
        }
        return   ResultInfo.renderError("查询视频切片信息失败");
    }
}
